<?php
//str_replace — 子字符串替换
//str_replace(
//     array|string $search,
//     array|string $replace,
//     string|array $subject,
//     int &$count = null
// ): string|array
//由于 str_replace() 的替换时从左到右依次进行的，进行多重替换的时候可能会替换掉之前插入的值。参见该文档的示例。 
//示例2
$phrase  = "You should eat fruits, vegetables, and fiber every day.";

 

$healthy = array("fruits", "vegetables", "fiber");
$yummy   = array("pizza", "beer", "ice cream");
$newphrase = str_replace($healthy, $yummy, $phrase);
echo $newphrase;

